package com.cxb.util;

import lombok.extern.slf4j.Slf4j;

import java.time.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Slf4j
public class LocalDateTest {

    public  void main2(String[] args) {
        String timeStamp = String.valueOf(LocalDateTime.now().toInstant(ZoneOffset.UTC).toEpochMilli());
        long epochMilli = LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
        long time = new Date().getTime();
        log.info("timeStamp:{}",timeStamp);
        log.info("epochMilli:{}",epochMilli);
        log.info("dateTime:{}",time);

    }

    public static void main(String[] args) {
        String config = "{'OTk2':'1839=348fa4c55cf3455b93feaf68801280a7,1840=1468ea27e6a3459ca76770e1ab99f44a,1841=be2cea3c812e4797856e5722de6bb7d8,1842=8da21393fe4b4642a77aa7226e458c89,1843=21dc8be36674460f9f9150f38ece6a68,1844=bc732d0ccefe41ec87b85171dc92e682,1845=8b5e225aff0a4e9e8379f38efc9d63f3','OTk1':'1850=dff7f9b075fa4f7686e41e934983d9ac,1851=b7d1318b5c8c472991dbfa401a34aca8,1853=69db64954c5441f69b3c89b8f5fb3f67'}";
        // 获取当前日期
        List<Long> blockIds = new ArrayList<>();
        // 去掉首尾的花括号
        config = config.substring(1, config.length() - 1);

        // 按照逗号分隔，得到各个键值对
        String[] pairs = config.split("','");

        for (String pair : pairs) {
            // 去掉键值对中的单引号
            pair = pair.replace("'", "");

            // 按照冒号分隔，得到键和值
            String[] keyValue = pair.split(":");

            // 获取值部分
            String values = keyValue[1];

            // 按照逗号分隔值部分，得到各个子项
            String[] items = values.split(",");

            for (String item : items) {
                // 按照等号分隔子项，得到关键信息
                String key = item.split("=")[0];
                blockIds.add(Long.valueOf(key));
            }
        }
        System.out.println(blockIds);;
    }
}
